package bishi.tengxun.three;

import java.util.Deque;
import java.util.LinkedList;
import java.util.Scanner;

/**
 * @author: Tangxz
 * @email: 1171702529@qq.com
 * @cate: 2021/09/26 20:39
 */
public class three {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        Deque<String> strDeque = new LinkedList<>();
        Deque<Integer> intDeque = new LinkedList<>();
        char[] chars = str.toCharArray();
        int len = chars.length;
        boolean p = false;
        for (int i = 0; i <= len; i++) {
            if (strDeque.size() > 0 && p) {
                while (strDeque.size() > 0 &&
                        (
                                i == len
                                || strDeque.peekLast().equals("@")
                                || (strDeque.peekLast().equals("x") && chars[i] != '@')
                                || (strDeque.peekLast().equals("+") && chars[i] != '@' && chars[i] != 'x')
                        )
                ) {
                    String s = strDeque.pollLast();
                    int num = 0;
                    switch (s.charAt(0)) {
                        case '+':
                            num = intDeque.pollLast() + intDeque.pollLast();
                            intDeque.offerLast(num);
                            break;
                        case 'x':
                            num = intDeque.pollLast() * intDeque.pollLast();
                            intDeque.offerLast(num);
                            break;
                        case '@':
                            int b = intDeque.pollLast();
                            int a = intDeque.pollLast();
                            num = a | (a + b);
                            intDeque.offerLast(num);
                            break;
                    }
                }
            }
            if (i == len) {
                break;
            }
            if (chars[i] >= '0' && chars[i] <= '9') {
                int num = chars[i++] - '0';
                while (i < len && chars[i] >= '0' && chars[i] <= '1') {
                    num = num * 10 + (chars[i++] - '0');
                }
                intDeque.offerLast(num);
                i--;
                p = true;
            } else {
                p = false;
                strDeque.offerLast(String.valueOf(chars[i]));
            }
        }
        System.out.println(intDeque.pollLast());
    }
}
